home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performOffsetCurve.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  17.5 KB  |  640 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  28 April 1997
  22. //  Author:         mpw
  23. //
  24. //  Description:
  25. //        Initialize the option values for offset curve menu item.
  26. //
  27. //  Input Arguments:
  28. //      int action
  29. //          0 - just execute the offset curve operation
  30. //        1 - show the option box dialog
  31. //          2 - drag to shelf
  32. //
  33. //  Return Value:
  34. //      None.
  35. //
  36.  
  37. proc setOptionVars(int $forceFactorySettings)
  38. {
  39.     //    Connect breaks (0=off 1=circular 2=linear).
  40.     //
  41.     if ($forceFactorySettings || !`optionVar -exists offsetCurveConnectBreaks`){
  42.         optionVar -intValue offsetCurveConnectBreaks 2;
  43.     }
  44.  
  45.     //    Stitch (on-1 or off-0).
  46.     //
  47.     if ($forceFactorySettings || !`optionVar -exists offsetCurveStitch`) {
  48.         optionVar -intValue offsetCurveStitch 1;
  49.     }
  50.  
  51.     // Global or local tolerance:
  52.     if( $forceFactorySettings || !`optionVar -exists offsetCurveUseGlobalTol` ){
  53.         optionVar -intValue offsetCurveUseGlobalTol false;
  54.     }
  55.  
  56.     //    Cut loops (on-1 or off-0).
  57.     //
  58.     if ($forceFactorySettings || !`optionVar -exists offsetCurveLoopCutting`) {
  59.         optionVar -intValue offsetCurveLoopCutting 1;
  60.     }
  61.  
  62.     //    Radius (used if cut loops is on).
  63.     //
  64.     if ($forceFactorySettings || !`optionVar -exists offsetCurveCutRadius`) {
  65.         optionVar -floatValue offsetCurveCutRadius 0.0;
  66.     }
  67.  
  68.     //    Offset distance.
  69.     //
  70.     if ($forceFactorySettings || !`optionVar -exists offsetCurveDistance`) {
  71.         optionVar -floatValue offsetCurveDistance 1.0;
  72.     }
  73.  
  74.     //    Tolerance control (on-1 or off-0 used for depth and bias).
  75.     //
  76.     if ($forceFactorySettings || !`optionVar -exists offsetCurveTolerance`) {
  77.         optionVar -floatValue offsetCurveTolerance 0.01;
  78.     }
  79.  
  80.     //    Subdivision density
  81.     //
  82.     if ($forceFactorySettings || !`optionVar -exists offsetCurveSubdivDensity`){
  83.         optionVar -intValue offsetCurveSubdivDensity 5;
  84.     }
  85.  
  86.     //    Normal direction (plane or geometry average??).
  87.     //
  88.     if ($forceFactorySettings ||
  89.         !`optionVar -exists offsetCurveNormalDirection`) {
  90.         optionVar -intValue offsetCurveNormalDirection 1;
  91.     }
  92.  
  93.     // curve range
  94.     if ($forceFactorySettings ||
  95.         !`optionVar -exists offsetCurveRangePartial`){
  96.         optionVar -intValue offsetCurveRangePartial 0;
  97.     }
  98.  
  99. }
  100.  
  101. //
  102. //  Procedure Name:
  103. //      offsetCurveSetup
  104. //
  105. //  Description:
  106. //        Update the state of the option box UI to reflect the offsetCurve
  107. //        option values.
  108. //
  109. //  Input Arguments:
  110. //      parent               - Top level parent layout of the option box UI.
  111. //                             Required so that UI object names can be 
  112. //                             successfully resolved.
  113. //
  114. //        forceFactorySettings - Whether the option values should be set to
  115. //                             default values.
  116. //
  117. //  Return Value:
  118. //      None.
  119. //
  120. global proc offsetCurveSetup( string $parent,
  121.                               int $forceFactorySettings,
  122.                               string $goToTool )
  123. {
  124.     //    Retrieve the option settings
  125.     //
  126.     setOptionVars($forceFactorySettings);
  127.     offsetCurveToolSetup( $forceFactorySettings, $goToTool );
  128.  
  129.     setParent $parent;
  130.  
  131.     //    Query the optionVar's and set the values into the controls.
  132.  
  133.     // normal direction
  134.     int $dir = `optionVar -q offsetCurveNormalDirection`+1 ;
  135.     radioButtonGrp -edit -select $dir offsetCurveNormalRadioButtonGrp ;        
  136.  
  137.     //    Distance
  138.     //
  139.     floatSliderGrp -edit 
  140.         -value `optionVar -q offsetCurveDistance`
  141.         offsetCurveDistanceFloatSliderGrp;
  142.  
  143.     //    Connect breaks.
  144.     //
  145.     int $doConnectBreaks = `optionVar -q offsetCurveConnectBreaks`;
  146.     if( 0 == $doConnectBreaks ) $doConnectBreaks = 3;
  147.     radioButtonGrp -edit -select $doConnectBreaks
  148.         offsetCurveConnectBreaksRadioButtonGrp;
  149.  
  150.     // Global vs. local tolerance
  151.     int $useGlobalTol = `optionVar -q offsetCurveUseGlobalTol`;
  152.     radioButtonGrp -e -select (2 - $useGlobalTol) useGlobalTol;
  153.  
  154.     //    Loop cutting.
  155.     //
  156.     int $doLoopCutting = `optionVar -q offsetCurveLoopCutting`;
  157.     radioButtonGrp -edit 
  158.         -select (2 - $doLoopCutting)
  159.         offsetCurveLoopCuttingRadioButtonGrp;
  160.  
  161.     //    Cut radius
  162.     //
  163.     floatSliderGrp -edit 
  164.         -value `optionVar -q offsetCurveCutRadius`
  165.         -enable $doLoopCutting
  166.         offsetCurveCutRadiusFloatSliderGrp;
  167.  
  168.     //    Subdivision density
  169.     //
  170.     intSliderGrp -edit 
  171.         -value `optionVar -q offsetCurveSubdivDensity`
  172.         offsetCurveSubdivDensityIntSliderGrp;
  173.  
  174.     //    Tolerance
  175.     //
  176.     floatSliderGrp -edit 
  177.         -v `optionVar -q offsetCurveTolerance`
  178.         offsetCurveTolerance;
  179.  
  180.     // curve range on inputs.
  181.     //
  182.     int $offsetCurveRangePartial = `optionVar -q offsetCurveRangePartial`+1 ;
  183.     radioButtonGrp -edit -select $offsetCurveRangePartial 
  184.         offsetCurveRangeRadioButtonGrp ;        
  185.  
  186.     // loop cut tab on/off
  187.     if( $doLoopCutting ) {
  188.         tabLayout -e -selectTab offsetCurveLoopCut_C
  189.             offsetCurveLoopCutOptions_Tabs;
  190.     }
  191.     else {
  192.         tabLayout -e -selectTab offsetCurveNoLoopCut_C
  193.             offsetCurveLoopCutOptions_Tabs;
  194.     }
  195.  
  196.     if( $useGlobalTol ) {
  197.         tabLayout -e -selectTab noSlider useGlobalTolTab;
  198.     }
  199.     else {
  200.         tabLayout -e -selectTab slider useGlobalTolTab;
  201.     }
  202.  
  203.     if( "" != $goToTool ) { 
  204.         checkBoxGrp -e -v1 `scriptCtx -q -euc $goToTool`
  205.           scriptToolExtraWidget;
  206.         checkBoxGrp -e -v2 `scriptCtx -q -lac $goToTool`
  207.           scriptToolExtraWidget;
  208.     }
  209. }
  210.  
  211. //
  212. //  Procedure Name:
  213. //      offsetCurveCallback
  214. //
  215. //  Description:
  216. //        Update the option values with the current state of the option box UI.
  217. //
  218. //  Input Arguments:
  219. //      parent - Top level parent layout of the option box UI.  Required so
  220. //               that UI object names can be successfully resolved.
  221. //
  222. //        doIt   - Whether the command should execute.
  223. //
  224. //  Return Value:
  225. //      None.
  226. //
  227. global proc offsetCurveCallback(string $parent, int $doIt, string $goToTool)
  228. {
  229.     if( "" != $goToTool ) {
  230.         optionVar -iv offsetCurveEuc `scriptCtx -q -euc $goToTool`;
  231.         optionVar -iv offsetCurveLac `scriptCtx -q -lac $goToTool`;
  232.     }
  233.     setParent $parent;
  234.  
  235.     //    Set the optionVar's from the control values, and then
  236.     //    perform the command.
  237.  
  238.     // normal direction.
  239.     int $dir = `radioButtonGrp -q -select offsetCurveNormalRadioButtonGrp` - 1 ;
  240.     optionVar -intValue offsetCurveNormalDirection $dir  ;
  241.  
  242.     // distance
  243.     optionVar -floatValue offsetCurveDistance
  244.         `floatSliderGrp -q -value offsetCurveDistanceFloatSliderGrp`;
  245.  
  246.     // connect breaks, setting correct option value
  247.     int $breaks =
  248.         `radioButtonGrp -q -select offsetCurveConnectBreaksRadioButtonGrp`;
  249.     if( 3 == $breaks ) $breaks = 0;
  250.     optionVar -intValue offsetCurveConnectBreaks $breaks;
  251.  
  252.     // global vs. local:
  253.     int $useGlobalTol = 2 - `radioButtonGrp -q -select useGlobalTol`;
  254.     optionVar -intValue offsetCurveUseGlobalTol $useGlobalTol;
  255.  
  256.     // loop cutting, setting correct option value
  257.     int $lc = 2 -
  258.         `radioButtonGrp -q -select offsetCurveLoopCuttingRadioButtonGrp`;
  259.     optionVar -intValue offsetCurveLoopCutting $lc;
  260.  
  261.     // cut radius
  262.     optionVar -floatValue offsetCurveCutRadius
  263.         `floatSliderGrp -q -value offsetCurveCutRadiusFloatSliderGrp`;
  264.  
  265.     // subdivision density
  266.     optionVar -intValue offsetCurveSubdivDensity
  267.         `intSliderGrp -q -value offsetCurveSubdivDensityIntSliderGrp`;
  268.  
  269.     // tolerance
  270.     optionVar -floatValue offsetCurveTolerance
  271.         `floatSliderGrp -q -v offsetCurveTolerance`;
  272.  
  273.     // curve range
  274.     int $offsetCurveRangePartial =
  275.         `radioButtonGrp -q -select offsetCurveRangeRadioButtonGrp` - 1 ;
  276.     optionVar -intValue offsetCurveRangePartial $offsetCurveRangePartial;
  277.  
  278.     if( 1 == $doIt ) {
  279.         performOffsetCurve( 0, $goToTool ); 
  280.         string $tmpCmd = "performOffsetCurve( 0, \"" + $goToTool + "\")";
  281.         addToRecentCommandQueue $tmpCmd "Offset Curve";
  282.     }
  283.     else if ($doIt) {
  284.         setToolTo $goToTool;
  285.     }
  286. }
  287.  
  288. //
  289. //  Procedure Name:
  290. //      createOffsetCurveUI
  291. //
  292. //  Description:
  293. //        Fill the contents of the option box for offsetCurve command.
  294. //
  295. //  Input Arguments:
  296. //      The name of the parent layout.
  297. //
  298. //  Return Value:
  299. //      None.
  300. //
  301. proc createOffsetCurveUI(string $parent, int $inTheTool, string $goToTool)
  302. {
  303.    setParent $parent;
  304.  
  305.    radioButtonGrp -nrb 2 -select 1 -l "Normal Direction" -l1 "Active View"
  306.        -l2 "Geometry Average" offsetCurveNormalRadioButtonGrp;
  307.  
  308.    floatSliderGrp -field on -fmn -1000. -fmx 1000. 
  309.        -min -10. -max 10. 
  310.        -l "Offset Distance"
  311.        offsetCurveDistanceFloatSliderGrp;
  312.  
  313.    radioButtonGrp -nrb 3 -select 1 
  314.        -l "Connect Breaks"
  315.        -l1 "Circular"
  316.        -l2 "Linear"
  317.        -l3 "Off"
  318.        offsetCurveConnectBreaksRadioButtonGrp;
  319.  
  320.    string $tabLayoutName = (`setParent -q` + "|offsetCurveLoopCutOptions_Tabs");
  321.  
  322.    radioButtonGrp -nrb 2 -select 1 
  323.        -l "Loop Cutting"
  324.        -l1 "On"
  325.        -l2 "Off"
  326.        -on1 ("tabLayout -e -selectTab offsetCurveLoopCut_C " + "\"" + $tabLayoutName + "\"" + ";")
  327.        -on2 ("tabLayout -e -selectTab offsetCurveNoLoopCut_C " + "\"" + $tabLayoutName + "\"" + ";")
  328.        offsetCurveLoopCuttingRadioButtonGrp;
  329.    
  330.    tabLayout -tabsVisible false offsetCurveLoopCutOptions_Tabs;
  331.        columnLayout offsetCurveLoopCut_C;
  332.        floatSliderGrp -field on -fmn 0. -fmx 1000. 
  333.            -min 0. -max 1. 
  334.            -l "Cutting Radius"
  335.            offsetCurveCutRadiusFloatSliderGrp;
  336.        setParent ..;
  337.  
  338.        columnLayout offsetCurveNoLoopCut_C;
  339.        setParent ..;
  340.  
  341.    setParent ..;
  342.  
  343.    intSliderGrp -field on -min 0 -max 10 
  344.        -fmn 0 -fmx 100 
  345.        -l "Max Subdivision Density"
  346.        offsetCurveSubdivDensityIntSliderGrp;
  347.  
  348.    radioButtonGrp -nrb 2 -l "Use Tolerance"
  349.        -l1 "Global"
  350.        -l2 "Local"
  351.        -on1 "tabLayout -e -selectTab noSlider useGlobalTolTab"
  352.        -on2 "tabLayout -e -selectTab slider useGlobalTolTab"
  353.        useGlobalTol;
  354.  
  355.    tabLayout -tabsVisible false useGlobalTolTab;
  356.        columnLayout slider;
  357.            floatSliderGrp -l "Tolerance" 
  358.                -min 0.001 -max 1.0 -fmn 0.00001 -fmx 10.0
  359.                offsetCurveTolerance;
  360.        setParent ..;
  361.        columnLayout noSlider;
  362.        setParent ..;
  363.    setParent ..;
  364.  
  365.    separator;
  366.  
  367.     // layout for add curve range, create as polygons.
  368.     //
  369.    radioButtonGrp -nrb 2 -label "Curve Range" -label1 "Complete" -label2 "Partial" -select 1 offsetCurveRangeRadioButtonGrp;
  370.  
  371.     if( $inTheTool ) {
  372.         separator;
  373.         checkBoxGrp -ncb 2 -l "Tool Behavior"
  374.           -l1 "Exit on Completion"
  375.           -v1 off
  376.           -on1 ("scriptCtx -e -euc true " + $goToTool)
  377.           -of1 ("scriptCtx -e -euc false " + $goToTool)
  378.  
  379.           -l2 "Auto Completion"
  380.           -v2 on
  381.           -on2 ("scriptCtx -e -lac true " + $goToTool)
  382.           -of2 ("scriptCtx -e -lac false " + $goToTool)
  383.           scriptToolExtraWidget;
  384.     }
  385. }
  386.  
  387. //
  388. //  Procedure Name:
  389. //      offsetCurveOptions
  390. //
  391. //  Description:
  392. //        Construct the option box UI.  Involves accessing the standard option
  393. //        box and customizing the UI accordingly.
  394. //
  395. //  Input Arguments:
  396. //      None.
  397. //
  398. //  Return Value:
  399. //      None.
  400. //
  401. proc offsetCurveOptions( int $inTheTool, string $goToTool )
  402. {
  403.     //    Name of the command for this option box.
  404.     //
  405.     string $commandName = "offsetCurve";
  406.     string $optionBoxTitle;
  407.     if( $inTheTool ) {
  408.         $optionBoxTitle = "Offset Curve Tool Options";
  409.     }
  410.     else {
  411.         $optionBoxTitle = "Offset Curve Options";
  412.     }
  413.  
  414.     //    Build the option box actions.
  415.     //
  416.     string $callback = ($commandName + "Callback");
  417.     string $setup = ($commandName + "Setup");
  418.  
  419.     global string $gOptionBoxActionToolItem;
  420.     $gOptionBoxActionToolItem = "modelWithToolOffsetCurve";
  421.     global string $gOptionBoxActionToolItemCB;
  422.     $gOptionBoxActionToolItemCB = "offsetCurveToolScript 3";
  423.  
  424.     //  The value returned is the name of the layout to be used as
  425.     //    the parent for the option box UI.
  426.     //
  427.     string $layout = getOptionBox();
  428.     setParent $layout;
  429.     
  430.     //    Pass the command name to the option box.
  431.     //
  432.     //    Any default option box behavior based on the command name is set 
  433.     //    up with this call.
  434.     //
  435.     setOptionBoxCommandName($commandName);
  436.     
  437.     //    Activate the default UI template so that the layout of this 
  438.     //    option box is consistent with the layout of the rest of the 
  439.     //    application.
  440.     //
  441.     setUITemplate -pushTemplate DefaultTemplate;
  442.  
  443.     //    Turn on the wait cursor.
  444.     //
  445.     waitCursor -state 1;
  446.  
  447.     //    RECOMMENDATION:  Place the UI in a scroll layout.  If the 
  448.     //    option box window is ever resized such that it's entire 
  449.     //    contents is not visible then the scroll bars provided by the
  450.     //    scroll layout will allow the user to access the hidden UI.
  451.     //
  452.     tabLayout -scr true -tv false;
  453.     
  454.     string $parent = `columnLayout -adjustableColumn 1`;
  455.  
  456.     //    Create the UI for the tab that is initially visible.
  457.     //
  458.     createOffsetCurveUI($parent, $inTheTool, $goToTool);
  459.  
  460.     //    Turn off the wait cursor.
  461.     //
  462.     waitCursor -state 0;
  463.  
  464.     //    Deactivate the default UI template.
  465.     //
  466.     setUITemplate -popTemplate;
  467.  
  468.     //    Attach actions to those buttons that are applicable to the option
  469.     //    box.  Note that the 'Close' button has a default action attached 
  470.     //    to it that will hide the window.  If a a custom action is
  471.     //    attached to the 'Close' button then be sure to call the 'hide the
  472.     //    option box' procedure within the custom action so that the option
  473.     //    box is hidden properly.
  474.  
  475.     //    'OffsetCurve' button.
  476.     //
  477.     string $applyBtn = getOptionBoxApplyBtn();
  478.     if( $inTheTool ) {
  479.         button -edit
  480.             -label "Offset Tool"
  481.             -command ($callback + " " + $parent + " 3 \"" + $goToTool + "\"")
  482.             $applyBtn;
  483.     }
  484.     else {
  485.         button -edit
  486.             -label "Offset"
  487.             -command ($callback + " " + $parent + " 1 \"" + $goToTool + "\"")
  488.             $applyBtn;
  489.     }
  490.  
  491.     //    'Save' button.
  492.     //
  493.     string $saveBtn = getOptionBoxSaveBtn();
  494.     button -edit 
  495.         -command ($callback + " " + $parent + " 0 \"" +
  496.                   $goToTool + "\"; hideOptionBox")
  497.         $saveBtn;
  498.  
  499.     //    'Reset' button.
  500.     //
  501.     string $resetBtn = getOptionBoxResetBtn();
  502.     button -edit 
  503.         -command ($setup + " " + $parent + " 1 \"" + $goToTool + "\"")
  504.         $resetBtn;
  505.  
  506.     //    Set the option box title.
  507.     //
  508.     setOptionBoxTitle($optionBoxTitle);
  509.  
  510.     //    Customize the 'Help' menu item text.
  511.     //
  512.     setOptionBoxHelpTag( "OffsetCurve" );
  513.  
  514.     //    Set the current values of the option box.
  515.     //
  516.     eval ($setup + " " + $parent + " 0 \"" + $goToTool + "\"");    
  517.     
  518.     //    Show the option box.
  519.     //
  520.     showOptionBox();
  521. }
  522.  
  523. //
  524. //  Procedure Name:
  525. //      offsetCurveHelp
  526. //
  527. //  Description:
  528. //        Returns a short description about the offsetCurve command.
  529. //
  530. //  Input Arguments:
  531. //      None.
  532. //
  533. //  Return Value:
  534. //      string.
  535. //
  536. proc string offsetCurveHelp()
  537. {
  538.     return 
  539.     "  Command: OffsetCurve - create a offset 3d curve from a 2d or 3d curve.\n" +
  540.     "Select at least one curve to offset.";    
  541. }
  542.  
  543. //
  544. //  Procedure Name:
  545. //      assembleCmd
  546. //
  547. //  Description:
  548. //        Construct the offsetCurve command that will apply the option box 
  549. //        values.
  550. //
  551. //  Input Arguments:
  552. //      None.
  553. //
  554. //  Return Value:
  555. //      The offsetCurve command string.
  556. //
  557. proc string assembleCmd()
  558. {
  559.     setOptionVars(false);
  560.  
  561.     string $cmd = "offsetCurvePreset";
  562.     $cmd = $cmd + "(" ;
  563.  
  564.     // get the global history flag value
  565.     int $doHistory = `constructionHistory -q -tgl`;
  566.     $cmd = $cmd + $doHistory + ",";
  567.     int $curveRangePartial = `optionVar -q offsetCurveRangePartial`;
  568.     $cmd = $cmd + $curveRangePartial + "," ;  
  569.     int $connectBreaks = `optionVar -q offsetCurveConnectBreaks`;
  570.     $cmd = $cmd + $connectBreaks + ",";
  571.     int $stitch = `optionVar -q offsetCurveStitch`;
  572.     $cmd = $cmd + $stitch + ",";
  573.     int $cutLoop = `optionVar -q offsetCurveLoopCutting`;
  574.     $cmd = $cmd + $cutLoop + ",";
  575.     float $cutRadius = `optionVar -q offsetCurveCutRadius`;
  576.     $cmd = $cmd + $cutRadius + ",";
  577.     float $distance = `optionVar -q offsetCurveDistance`;
  578.     $cmd = $cmd + $distance + ",";
  579.     float $tolerance = `optionVar -q offsetCurveTolerance`;
  580.     if( `optionVar -q offsetCurveUseGlobalTol` ) {
  581.         $tolerance = `optionVar -q positionalTolerance`;
  582.     }
  583.     $cmd = $cmd + $tolerance + ",";
  584.     int $subdivDensity = `optionVar -q offsetCurveSubdivDensity`;
  585.     $cmd = $cmd + $subdivDensity + ",";
  586.     int $normalDir = `optionVar -q offsetCurveNormalDirection`;
  587.     $cmd = $cmd + $normalDir;
  588.     $cmd = $cmd + ")";
  589.  
  590.     return $cmd;
  591. }
  592.  
  593. //
  594. //  Procedure Name:
  595. //      performOffsetCurve
  596. //
  597. //  Description:
  598. //        Perform the offsetCurve command using the corresponding 
  599. //        option values.  This procedure will also show the option box
  600. //        window if necessary as well as construct the command string
  601. //        that will invoke the offsetCurve command with the current
  602. //        option box values.
  603. //
  604. //  Input Arguments:
  605. //      0 - Execute the command.
  606. //      1 - Show the option box dialog.
  607. //      2 - Return the command to drag to shelf.
  608. //
  609. //  Return Value:
  610. //      The offsetCurve command string.
  611. //
  612. global proc string performOffsetCurve( int $action, string $goToTool )
  613. {
  614.     int $inTheTool = false;
  615.     if( 3 == $action ) {
  616.         $action = 1;
  617.         $inTheTool = true;
  618.     }
  619.  
  620.     string $cmd = "";
  621.     switch ($action) {
  622.       case 0:
  623.         setOptionVars(false);
  624.         $cmd = `assembleCmd`;
  625.         eval($cmd);
  626.         break;
  627.  
  628.       case 1:
  629.         offsetCurveOptions( $inTheTool, $goToTool );
  630.         break;
  631.  
  632.       case 2:
  633.       default:
  634.         setOptionVars(false);
  635.         $cmd = `assembleCmd`;
  636.         break;
  637.     }
  638.     return $cmd;
  639. }
  640.